# include <cstdio>
# include <algorithm>
# include <iostream>
# define MAXN 15023
using namespace std;

inline char gc() { 
    static char buf[1 << 18], *fs, *ft;
    return (fs == ft && (ft = (fs = buf) + fread(buf, 1, 1 << 18, stdin)), fs == ft) ? EOF : *fs++;
}

inline int gn() { 
    register char c;
    int k = 0, f = 1;
    c = gc();
    for(; !isdigit(c); c = gc()) if(c == '-') f = -1;
    for(; isdigit(c); c = gc()) k = k * 10 + c - '0';
    return k * f;
}

int mg[MAXN], wz[MAXN][4], n, m;

bool judge(int a, int b, int c, int d) { 
    return (b - a == (d - c) << 1) && (b - a < (c - b) / 3);
}

int main() { 
    n = gn(), m = gn();
    for(int i = 1; i <= m; i++) mg[i] = gn();
    for(int i = 1; i <= m; i++) { 
        for(int j = i + 1; j <= m; j++) { 
            if(mg[j] <= mg[i]) continue;
            for(int k = j + 1; k <= m; k++) { 
                if(mg[k] <= mg[j]) continue;
                for(int l = k + 1; l <= m; l++) { 
                    if(mg[l] <= mg[k]) continue;
                    if(judge(mg[i], mg[j], mg[k], mg[l])) { 
                        wz[i][0]++;
                        wz[j][1]++;
                        wz[k][2]++;
                        wz[l][3]++;
                    }
                }
            }
        }
    }
    for(int i = 1; i <= m; i++) printf("%d %d %d %d\n", wz[i][0], wz[i][1], wz[i][2], wz[i][3]);
}
